//
//  CollectionViewCell.m
//  MyProject
//
//  Created by dllo on 15/10/31.
//  Copyright (c) 2015年 蓝鸥0825. All rights reserved.
//

#import "CollectionViewCell.h"

#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height
@implementation CollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        self.label = [[UILabel alloc] init];
        [self addSubview:self.label];
        [_label release];
        
        self.image = [[UIImageView alloc] init];
        [self addSubview:self.image];
        [_image release];
        
        self.button = [UIButton buttonWithType:UIButtonTypeSystem];
        [self addSubview:self.button];
        
        
        self.labelProvice = [[UILabel alloc] init];
        [self addSubview:self.labelProvice];
        [_labelProvice release];
        
        
        self.labelProviceSec = [[UILabel alloc] init];
        [self addSubview:self.labelProviceSec];
        [_labelProviceSec release];
        
        self.labelCount = [[UILabel alloc] init];
        [self addSubview: self.labelCount];
        [_labelCount release];
        
        self.labelCount.layer.borderWidth = 2;
//        self.label.layer.borderWidth = 1;
//        self.image.layer.borderWidth = 1;
//        self.labelProvice.layer.borderWidth = 1;
//        self.labelProviceSec.layer.borderWidth = 1;
//        self.button.layer.borderWidth = 1;
        
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.labelCount.frame = CGRectMake(0, 0, WIDTH / 100 * 30, HEIGHT / 100 * 8);
    self.image.frame = CGRectMake(0, 0, WIDTH, HEIGHT / 100 * 70);
    self.label.frame = CGRectMake(0, HEIGHT / 100 * 70, WIDTH, HEIGHT / 100 * 10);
    self.labelProvice.frame = CGRectMake(0, HEIGHT / 100 * 80, WIDTH / 100 * 30, HEIGHT / 100 * 20);
    self.labelProviceSec.frame = CGRectMake(WIDTH / 100 * 30, HEIGHT / 100 * 80, WIDTH / 100 * 20 , HEIGHT / 100 * 20);
    self.button.frame = CGRectMake(WIDTH / 100 * 80, HEIGHT / 100 * 84, WIDTH / 100 * 20 , HEIGHT / 100 * 12);
    
    self.button.layer.cornerRadius = HEIGHT / 100 * 10 / 2;
    self.labelCount.textColor = [UIColor whiteColor];
    self.labelCount.backgroundColor = [UIColor redColor];
    self.labelCount.layer.borderColor = [UIColor redColor].CGColor;
    self.labelCount.font = [UIFont systemFontOfSize:18 weight:8];
    [self.button setTitle:@"马上抢" forState:UIControlStateNormal];
    [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.button.backgroundColor = [UIColor redColor];
    self.label.textAlignment = 1;
    self.labelProvice.font = [UIFont systemFontOfSize:25 weight:18];
    self.labelProvice.textColor = [UIColor redColor];
    self.labelProviceSec.textColor = [UIColor grayColor];
    self.labelProvice.textAlignment = 1;
    self.labelProviceSec.textAlignment = 1;
    
}


@end
